#include "testwidget.h"
#include "ui_testwidget.h"
#include<QDebug>
#include<QThread>
#include<QPainter>
#include<QPaintEvent>
#include<QtConcurrent>
//类外初始化
TestWidget*TestWidget::m_instance=nullptr;
QMutex TestWidget::m_mutex;

TestWidget::TestWidget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::TestWidget)
{
    ui->setupUi(this);

    setWindowModality(Qt::ApplicationModal);

    connect(ui->testBtn1,&QPushButton::clicked,this,&TestWidget::testSlot);
}

TestWidget::~TestWidget()
{
    delete ui;
}

TestWidget *TestWidget::getInstance()
{
    QMutexLocker locker(&m_mutex);
    if(!m_instance){
        m_instance=new TestWidget;
    }
    return m_instance;
}

void TestWidget::release()
{
    QMutexLocker locker(&m_mutex);
    if(m_instance){
        delete m_instance;
        m_instance=nullptr;
    }
}

void TestWidget::testSlot()
{

}



